package com.github.cyf.entity;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.*;
import java.math.BigDecimal;

/**
 * @author chenyifan
 * @create 2024-05-02 17:11
 */
@Data
public class User {

    @Length(min = 6, max = 12, message = "appId长度必须位于6到12之间")
    private String appId;

    @NotBlank(message = "名字不能为空或纯空格")
    private String name;

    @NotEmpty(message = "level不能为空")
    private String level;

    @Pattern(regexp = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(16([2-3]|[5-7]))|(17[013678])|(18[0,5-9])|(19[0-9]))\\d{8}$",message = "手机号格式不正确：支持11位手机号")
    private String phone;

    @Email(message = "请填写正确的邮箱地址")
    private String email;

    @Max(value = 100, message = "年龄不能超过100岁")
    @Min(value = 0, message = "年龄不能小于0岁")
    private Integer age;

    @DecimalMax(value = "100000000", message = "存款不能超过一个亿")
    @DecimalMin(value = "0", message = "存款不能小于0")
    private BigDecimal money;

    @Range(min = 1, max = 7,message = "每周从1到7")
    private int weekDay;

}
